﻿using System.Drawing;
using System.Drawing.Drawing2D;

namespace GMapNET
{
   public class Marker
   {
      public MarkerType Type;
      public PointLatLng Position;
      public MarkerColor Color;
      public MarkerTooltipMode TooltipMode;  
      public Point ToolTipOffset;
      public CustomMarkerAlign CustomMarkerAlign;
      public Point CustomMarkerCenter;
      public string Text;
      public bool Visible;
      public bool AlertWindowActive = false;
      public bool AlwaysVisible=false;
      public bool DrawRoute = false;
      public Image CustomMarker, AlternateMarker;
      public object Tag;
      public System.Drawing.Color borderColor = System.Drawing.Color.FromArgb(140, System.Drawing.Color.Blue);
      public Route Routes = new Route("", System.Drawing.Color.FromArgb(100, System.Drawing.Color.Blue));

      private bool isMouseOver; 
      public bool IsMouseOver
      {
         get
         {
            return isMouseOver;
         }
         internal set
         {
            isMouseOver = value;
         }
      }

      private bool isEditMode;
      public bool IsEditMode
      {
          get
          {
              return isEditMode;
          }
          internal set
          {
              isEditMode = value;
          }
      }

      private bool isDragging;
      public bool IsDragging
      {
          get
          {
              return isDragging;
          }
          internal set
          {
              isDragging = value;
          }
      }


      //public void UpdateRoute()
      //{
      //    if (tObject != null)
      //    {
      //        Routes.Points.Clear();
      //        foreach (TAV.Core.tObject h in tObject.History)
      //        {
      //            if (PPIBasketTracker.IO.ioUtils.isGPSValid(h.tS5))
      //            {
      //                string[] latlon = h.tS5.Split(',');
      //                double lat = 0.0, lon = 0.0;
      //                if (double.TryParse(latlon[0], out lat) && double.TryParse(latlon[1], out lon))
      //                {
      //                    if (lat != 0 && lon != 0)
      //                    {
      //                        PointLatLng p = new PointLatLng(lat, lon);
      //                        Routes.Points.Add(p);
      //                    }
      //                }
      //            }
      //        }
      //    }
      //}

      public Marker(PointLatLng pos, MarkerType type, MarkerColor color)
      {
         this.Position = pos;
         this.Type = type;
         this.Color = color;
         this.Text = string.Empty;
         this.TooltipMode = MarkerTooltipMode.OnMouseOver;
         this.Visible = true;
         this.isDragging = false;
         this.isEditMode = false;
         this.CustomMarkerAlign = CustomMarkerAlign.MiddleMiddle;
         this.CustomMarkerCenter = Point.Empty;

         this.IsMouseOver = false;
         this.ToolTipOffset = new Point(14, -44);
      }
   }

   public enum MarkerType
   {
      Small,
      Medium,
      Custom,
   }

   public enum CustomMarkerAlign
   {
      MiddleMiddle,
      Manual,
   }

   public enum CurrentMarkerType
   {
      GMap,
      Cross,
      Custom,
   }

   public enum MarkerColor
   {
      Red,
      Green,
      Yellow,
      Blue,
   }

   public enum MarkerTooltipMode
   {
      OnMouseOver,
      Never,
      Always,
   }
}
